<?
/**
* Copyright (c) 2002-2007 BioWare Corp.
* http://www.bigdaddymonitor.org
*
* This file is part of the BigDaddy Monitoring
* program. It is free software distributed under
* the terms of the BSD License. It is ditributed
* in the hopes that it will be useful, but
* WITHOUT ANY WARRANTY; without event the implied
* warranty of MERCHANTABILITY or FITNESS FOR A
* PARTICULAR PURPOSE.
*
* The BSD License is available from:
* http://www.opensource.org/licenses/bsd-license.php
**/
?>
<style>

.uptimedata th
{
	text-align: left;
	background-color: #efefef;
	font-size: 9pt;
	font-weight: bold;
}

.uptimedata td
{
	border-bottom: 1px solid #888;
	font-size: 8pt;
	text-align: left;
}

.uptimedata td.greyline
{
	background-color: #efefef;
}

</style>

<div id="my-timeline" style="height: 400px; border: 1px solid #aaa"></div>

<?

$aIncident = $BigDaddyData->GetIncidentsByServerID($_REQUEST["serverID"]);

if (is_array($aIncident))
{
?>
<p style="color: #990000"><b>Incidents</b></p>

<ul>
<?
    foreach ($aIncident as $aRow)
    {
        echo "<li><a href=\"/incident/index.html?page=IncidentView&ID=".$aRow["incidentID"]."\">".$aRow["title"]."</a> (".get_time_str($aRow["incidentStart"], 1)."</li>";
    }
    ?>
</ul>
    <?
}
?>

<?


$aFilter = array(
		"application" => "server",
		"type" => "server_edit",
		"primaryNumericID" => $_REQUEST["serverID"],
		);
		
$aAuditData = $Audit->getAuditData($aFilter, "modifiedDate", true, 100);
?>
<p style="color: #990000"><b>Last 100 Actions...</b></p>
<?
if (is_array($aAuditData))
{
    ?>
    
		
		<table border="0" cellpadding="5" class="uptimedata">
		
		<thead>
		<th>User</th>
		<th>Date</th>
		<th>Action</th>
        <th>Comment</th>
		</thead>
    <?
    $k =1;
    foreach ($aAuditData as $aRow)
    {
        if ($k%2 == 0)
        {
            $sClass = " class = \"greyline\"";
        }
        else
        {
            $sClass = "";
        }
        ?>
        <tr>
        <td <?=$sClass;?>><?=$aRow["username"];?></td>
        <td <?=$sClass;?> nowrap><?=$aRow["modifiedDate"];?></td>
        <td <?=$sClass;?>><?=$aRow["action"];?></td>
        <td <?=$sClass;?>><?=substr($aRow["comment"], 0, 255)."...";?></td>
        </tr>
        
		
        <?
        $k++;
    }
    ?>
    </table>
    <?
}
else
{
    echo "<p>There are no actions recorded</p>";
}

?>
